#include "test-item-lip-recognition.h"

TestItemLipRecognition::TestItemLipRecognition()
{
}
TestItemLipRecognition::~TestItemLipRecognition()
{
}
int TestItemLipRecognition::recv_command_data(void *data, uint16_t length)
{
    if((NULL == data) || (length < 2))
    {
        printf("传入参数错误！\n");
        return -1;
    }

    int ret;
    uint8_t recvBuffer[length] = {0};
    uint8_t sendBuffer[2] = {0};
    sendBuffer[0] = TEST_LIP_RECOGNITION;

    memcpy(recvBuffer, data, length);

    if(recvBuffer[1] == TEST_START)//开始
    {
        sendBuffer[1] = TEST_STARTED;
        frameOperate.framePackageFunction(sendBuffer, sizeof(sendBuffer));
        printf("唇图测试开始！\n");
    }else if(recvBuffer[1] == TEST_STOP)//停止
    {
        sendBuffer[1] = TEST_STOPED;
        frameOperate.framePackageFunction(sendBuffer, sizeof(sendBuffer));
        printf("唇图测试结束！\n");
    }else
    {
        printf("数据错误：%x , %x \n", recvBuffer[0], recvBuffer[1]);
    }

    return 0;
}